import {
	AppWFRedirectViewActionType,
	IAppWFRedirectViewAbility,
	IAppWFRedirectViewControllerParams,
	IAppWFRedirectViewModel,
	IAppWFRedirectViewStore,
	IParam,
	IViewEvent,
} from '@/core';
import { QXEvent } from 'qx-util';
import {
	getViewClassNames,
	useViewAction,
	useViewBasic,
	useViewControllerParams,
	useViewProps,
} from '../use-view';

/**
 * 获取编辑视图输入参数
 *
 * @export
 * @return {*}
 */
export function useAppWFRedirectViewProps() {
	return {
		...useViewProps(),
	};
}

/**
 * 获取编辑视图基础
 *
 * @export
 * @param {IAppWFRedirectViewModel} model 编辑视图模型
 * @param {IParam} props 输入参数
 * @return {*}
 */
export function useAppWFRedirectViewBasic(
	model: IAppWFRedirectViewModel,
	props: IParam
) {
	const getClassNames = (props: IParam) => {
		return getViewClassNames(model, props);
	};
	return {
		...useViewBasic(model, props),
		getClassNames,
	};
}

/**
 * 编辑视图行为
 *
 * @export
 */
export function useAppWFRedirectViewAction(controller: any) {
	return {
		...useViewAction(controller),
	};
}

/**
 * 获取编辑视图控制器输入参数
 *
 * @export
 * @param {IAppWFRedirectViewModel} model
 * @param {IParam} props
 * @param {QXEvent<IViewEvent<AppWFRedirectViewActionType, IAppWFRedirectViewAbility>>} evt
 * @return {*}  {IAppWFRedirectViewControllerParams<AppWFRedirectViewActionType, IAppWFRedirectViewAbility>}
 */
export function useAppWFRedirectViewControllerParams(
	model: IAppWFRedirectViewModel,
	props: IParam,
	evt: QXEvent<
		IViewEvent<AppWFRedirectViewActionType, IAppWFRedirectViewAbility>
	>
): IAppWFRedirectViewControllerParams<
	AppWFRedirectViewActionType,
	IAppWFRedirectViewAbility
> {
	return {
		...useViewControllerParams<
			IAppWFRedirectViewStore,
			IAppWFRedirectViewModel
		>(model, props, evt),
	};
}
